package net.apexes.demo.codegen.querydsl.qvar;

import static com.querydsl.core.types.PathMetadataFactory.*;
import com.querydsl.core.types.dsl.*;

import java.sql.Types;
import javax.annotation.Generated;
import com.querydsl.core.types.Path;
import com.querydsl.core.types.PathMetadata;
import com.querydsl.sql.ColumnMetadata;
import com.querydsl.sql.ForeignKey;
import com.querydsl.sql.PrimaryKey;
import net.apexes.commons.querydsl.Index;
import net.apexes.demo.codegen.querydsl.entity.GoodsBase;
import net.apexes.demo.codegen.querydsl.qvar.QGoodsGroup;
import net.apexes.demo.codegen.querydsl.qvar.base.QEntityBase;

/**
 * QGoodsBase is a Querydsl query type for GoodsBase
 */
@Generated("net.apexes.codegen.core.MetadataSerializer")
public class QGoodsBase extends QEntityBase<GoodsBase> {

    private static final long serialVersionUID = -1996978612;

    public static final QGoodsBase $ = new QGoodsBase("GOODS_BASE");

    public final StringPath name = createString("name");

    public final StringPath quickCode = createString("quickCode");

    public final StringPath measureType = createString("measureType");

    public final StringPath goodsGroupId = createString("goodsGroupId");

    public final StringPath templateId = createString("templateId");

    public class PrimaryKeys {

        public final PrimaryKey<GoodsBase> constraint30 = createPrimaryKey(id);

    }

    public final PrimaryKeys pk = new PrimaryKeys();

    public class ForeignKeys {

        public final ForeignKey<QGoodsGroup> constraint301 = createForeignKey(goodsGroupId, "GOODS_GROUP", "ID");

    }

    public final ForeignKeys fk = new ForeignKeys();

    public class Indexs {

        public final Index constraintIndex30 = index("CONSTRAINT_INDEX_30").column(goodsGroupId).build();

        public final Index ixGoodsBaseStatusGroup = index("IX_GOODS_BASE_STATUS_GROUP").column(statusFlag).column(goodsGroupId, true).build();

        public final Index primaryKey30 = index("PRIMARY_KEY_30").unique().column(id).build();

    }

    public final Indexs ix = new Indexs();

    public QGoodsBase(String variable) {
        super(GoodsBase.class, forVariable(variable), "PUBLIC", "GOODS_BASE");
        addMetadata();
    }

    public QGoodsBase(String variable, String schema, String table) {
        super(GoodsBase.class, forVariable(variable), schema, table);
        addMetadata();
    }

    public QGoodsBase(Path<? extends GoodsBase> path) {
        super(path.getType(), path.getMetadata(), "PUBLIC", "GOODS_BASE");
        addMetadata();
    }

    public QGoodsBase(PathMetadata metadata) {
        super(GoodsBase.class, metadata, "PUBLIC", "GOODS_BASE");
        addMetadata();
    }

    public void addMetadata() {
        addMetadata(id, ColumnMetadata.named("ID").withIndex(1).ofType(Types.VARCHAR).withSize(22).notNull());
        addMetadata(name, ColumnMetadata.named("NAME").withIndex(2).ofType(Types.VARCHAR).withSize(32).notNull());
        addMetadata(quickCode, ColumnMetadata.named("QUICK_CODE").withIndex(3).ofType(Types.VARCHAR).withSize(8).notNull());
        addMetadata(measureType, ColumnMetadata.named("MEASURE_TYPE").withIndex(4).ofType(Types.CHAR).withSize(1).notNull());
        addMetadata(goodsGroupId, ColumnMetadata.named("GOODS_GROUP_ID").withIndex(5).ofType(Types.VARCHAR).withSize(22).notNull());
        addMetadata(statusFlag, ColumnMetadata.named("STATUS_FLAG").withIndex(6).ofType(Types.CHAR).withSize(1).notNull());
        addMetadata(version, ColumnMetadata.named("VERSION").withIndex(7).ofType(Types.VARCHAR).withSize(22).notNull());
        addMetadata(crtTime, ColumnMetadata.named("CRT_TIME").withIndex(8).ofType(Types.TIMESTAMP).withSize(26).withDigits(6).notNull());
        addMetadata(crtWho, ColumnMetadata.named("CRT_WHO").withIndex(9).ofType(Types.VARCHAR).withSize(22).notNull());
        addMetadata(updTime, ColumnMetadata.named("UPD_TIME").withIndex(10).ofType(Types.TIMESTAMP).withSize(26).withDigits(6));
        addMetadata(updWho, ColumnMetadata.named("UPD_WHO").withIndex(11).ofType(Types.VARCHAR).withSize(22));
        addMetadata(templateId, ColumnMetadata.named("TEMPLATE_ID").withIndex(12).ofType(Types.VARCHAR).withSize(22).notNull());
    }

    @Override
    public GoodsBase newEntity() {
        return new GoodsBase();
    }

    @Override
    public Object getFieldValue(GoodsBase entity, String fieldName) {
        switch (fieldName) {
            case "id":
                return entity.getId();
            case "name":
                return entity.getName();
            case "quickCode":
                return entity.getQuickCode();
            case "measureType":
                return entity.getMeasureType();
            case "goodsGroupId":
                return entity.getGoodsGroupId();
            case "statusFlag":
                return entity.getStatusFlag();
            case "version":
                return entity.getVersion();
            case "crtTime":
                return entity.getCrtTime();
            case "crtWho":
                return entity.getCrtWho();
            case "updTime":
                return entity.getUpdTime();
            case "updWho":
                return entity.getUpdWho();
            case "templateId":
                return entity.getTemplateId();
            default:
                return super.getFieldValue(entity, fieldName);
        }
    }

    @Override
    public void setFieldValue(GoodsBase entity, String fieldName, Object value) {
        switch (fieldName) {
            case "id":
                entity.setId((java.lang.String) value);
                break;
            case "name":
                entity.setName((java.lang.String) value);
                break;
            case "quickCode":
                entity.setQuickCode((java.lang.String) value);
                break;
            case "measureType":
                entity.setMeasureType((java.lang.String) value);
                break;
            case "goodsGroupId":
                entity.setGoodsGroupId((java.lang.String) value);
                break;
            case "statusFlag":
                entity.setStatusFlag((net.apexes.demo.codegen.entity.enums.StatusFlag) value);
                break;
            case "version":
                entity.setVersion((java.lang.String) value);
                break;
            case "crtTime":
                entity.setCrtTime((java.time.LocalDateTime) value);
                break;
            case "crtWho":
                entity.setCrtWho((java.lang.String) value);
                break;
            case "updTime":
                entity.setUpdTime((java.time.LocalDateTime) value);
                break;
            case "updWho":
                entity.setUpdWho((java.lang.String) value);
                break;
            case "templateId":
                entity.setTemplateId((java.lang.String) value);
                break;
            default:
                super.setFieldValue(entity, fieldName, value);
                break;
        }
    }

}

